package com.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.service.CollectMessageService;
import com.util.LoggerUtil;

@Controller
@RequestMapping("collectMessageController")
public class CollectMessageController {

	@Autowired
	private CollectMessageService collectMessageService;
	
	
	@RequestMapping(value="insertWeibo",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> insertWeibo(String userId, String oldId,HttpServletRequest request) {
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		logs.put("oldId", oldId);
		return collectMessageService.insertWeibo(userId, oldId,logs);
	}
	

	@RequestMapping(value="insertVideo",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> insertVideo(String userId, String oldId,HttpServletRequest request) {
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		logs.put("oldId", oldId);
		return collectMessageService.insertVideo(userId, oldId,logs);
	}

	@RequestMapping(value="insertArticle",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> insertArticle(String userId, String oldId,HttpServletRequest request) {
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		logs.put("oldId", oldId);
		return collectMessageService.insertArticle(userId, oldId,logs);
	}
	@RequestMapping(value="selectListCollectWeibo",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> selectListCollectWeibo(String userId,HttpServletRequest request){
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		return collectMessageService.selectListCollectWeibo(userId,logs);
	}
	@RequestMapping(value="selectListCollectArticle",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> selectListCollectArticle(String userId,HttpServletRequest request){
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		return collectMessageService.selectListCollectArticle(userId,logs);
	}
	@RequestMapping(value="selectListCollectVideo",method={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public Map<String, Object> selectListCollectVideo(String userId,HttpServletRequest request){
		JSONObject logs=JSONObject.fromObject(LoggerUtil.getParams(request));
		logs.put("userId", userId);
		return collectMessageService.selectListCollectVideo(userId,logs);
	}
}
